Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev: Add Keystone embed with Bookmark and Collection #213

Merged
merged 8 commits into from
Sep 8, 2021

Conversation

suzubara
Copy link
Contributor

@suzubara suzubara commented Sep 7, 2021

Description

This PR adds Keystone CMS in embedded mode so that we can develop the portal application against a CMS, prior to standing the CMS up as its own service. This approach is described in this ADR.

The Keystone entrypoint is added at keystone.ts -- this is where Keystone bootstraps all config, database settings, and the content schema. I added a basic schema for Bookmarks and Collections, as well as some corresponding tests.

schema.graphql and schema.prisma are both generated by Keystone but should be checked into VCS.

This also exposes a local URL for viewing the GraphQL API at: http://localhost:3000/api/graphql

I also did a little bit of housekeeping, updating .eslintignore & .prettierignore files.

Fixes #78

Review Notes

This has to be tested locally since Keystone-embed only works in local development. To test, check out this branch and run:

yarn
yarn dev

This should expose two URLs:
http://localhost:3000/ - the portal site
http://localhost:8000/ - the Keystone admin UI

Verify you can add Bookmarks/Collections as expected. Note that these aren't surfaced in the UI anywhere yet, so there is nothing to test in the portal itself (yet!). If you add content using the admin UI, there should be changes made to the cms.db file.

@@ -1,6 +1,5 @@
module.exports = {
testPathIgnorePatterns: ['/node_modules/', '.next/', 'cypress/'],
moduleDirectories: ['node_modules/', '.'],
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was causing babel transform errors when trying to test Keystone 😕

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does this change (if anything) moving forward?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we add directories under src/ that we want to be able to import from using absolute paths, they'll need to be added to this file so Jest can resolve the imports correctly

@suzubara suzubara changed the title Add Keystone embed with Bookmark and Collection dev: Add Keystone embed with Bookmark and Collection Sep 7, 2021
"storybook-css-modules-preset": "1.1.1",
"style-loader": "2.0.0",
"typescript": "4.4.2"
},
"resolutions": {
"@babel/runtime": "7.15.4"
},
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I ended up updating a bunch of packages because there were some incompatibilities causing Storybook to not run.

@suzubara suzubara marked this pull request as ready for review September 8, 2021 15:23
@suzubara suzubara added this to the prework: Keystone (embedded) milestone Sep 8, 2021
@jbecker01 jbecker01 linked an issue Sep 8, 2021 that may be closed by this pull request
Copy link
Contributor

@abbyoung abbyoung left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome!

@suzubara suzubara merged commit 1425d12 into main Sep 8, 2021
@suzubara suzubara deleted the 78-setup-keystone branch September 8, 2021 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Keystone (embed) Set up embedded Keystone with a dummy model
2 participants